package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zio {
   static boolean a(ArrayList var0) {
      if (var0 != null) {
         Iterator var1 = var0.iterator();

         while(var1.hasNext()) {
            Object var2 = var1.next();
            if (var2 != null && var2 instanceof String) {
               String var3 = (String)var2;
               if (var3.indexOf(10) != -1) {
                  return true;
               }
            }
         }
      }

      return false;
   }

   static boolean a(zik var0, zaay var1) {
      if (var0.f() == null) {
         return a(var0.d());
      } else {
         zagu var2 = (new zyg(var1, var0.f(), 0, -1)).a();
         var2 = zaaq.b(var2, var1);
         if (var2.b() == 9) {
            zaye var3 = ((zaal)var2).k();
            if (!var3.n() && !var3.o()) {
               if (var0.d() != null && var0.d().size() > 0) {
                  Iterator var4 = var0.d().iterator();

                  while(var4.hasNext()) {
                     Object var5 = var4.next();
                     if (var5 != null && !(var5 instanceof String)) {
                        return false;
                     }
                  }
               }

               return true;
            }
         }

         return false;
      }
   }

   static void a(ArrayList var0, String var1, ArrayList var2, boolean var3) {
      if (var0 != null) {
         Iterator var4 = var0.iterator();

         while(true) {
            while(true) {
               while(var4.hasNext()) {
                  Object var5 = var4.next();
                  zit var6 = new zit(var5, 0, (String)null);
                  var6.c = var1;
                  com.aspose.cells.b.a.a.ze.a(var2, (Object)var6);
                  if (!(var5 instanceof Double) && !(var5 instanceof Integer)) {
                     String var7 = null;
                     if (var5 instanceof DateTime) {
                        var7 = com.aspose.cells.b.a.zr.a((DateTime)var5);
                     } else {
                        var7 = (String)var5;
                     }

                     if (var7 == null) {
                        var6.g = 3;
                        var6.e = true;
                     } else if (var7.length() == 0) {
                        var6.g = 3;
                        var6.e = true;
                     } else if (zsk.c(var7)) {
                        var6.g = 2;
                        if (var3) {
                           var6.a = 0.0D;
                        }
                     } else if (var3 && zapb.b(var7)) {
                        var6.a = com.aspose.cells.b.a.zn.a(var7, com.aspose.cells.b.a.c.za.b());
                        var6.g = 4;
                     } else {
                        var6.g = 5;
                     }
                  } else {
                     var6.g = 4;
                  }
               }

               return;
            }
         }
      }
   }

   static Style a(Cells var0, int var1, int var2) {
      int var3 = var0.getRows().d(var1);
      if (var3 != -1) {
         Row var4 = var0.getRows().getRowByIndex(var3);
         if (var4.j()) {
            return var4.i();
         }
      }

      return null;
   }

   static String b(ArrayList var0) {
      StringBuilder var1 = new StringBuilder();
      var1.append('{');

      for(int var2 = 0; var2 < var0.size(); ++var2) {
         Object var3 = var0.get(var2);
         if (var3 instanceof Double) {
            double var4 = (Double)var3;
            if (var4 == (double)((int)var4)) {
               var1.append((int)var4);
            } else {
               var1.append(com.aspose.cells.a.c.zp.a(var4));
            }
         } else {
            var1.append((String)var3);
         }

         var1.append(',');
      }

      return var1.substring(0, var1.length() - 1) + "}";
   }

   static String[] a(String var0) {
      ArrayList var1 = new ArrayList();
      char[] var2 = var0.toCharArray();
      boolean var3 = false;
      int var4 = 0;

      for(int var5 = 0; var5 < var2.length; ++var5) {
         char var6 = var2[var5];
         if (var6 == '\'') {
            var3 = !var3;
         }

         if (!var3 && var6 == ',') {
            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new String(var2, var4, var5 - var4)));
            var4 = var5 + 1;
         }
      }

      if (var1.size() == 0) {
         return new String[]{var0};
      } else {
         com.aspose.cells.b.a.a.ze.a(var1, (Object)(new String(var2, var4, var2.length - var4)));
         String[] var7 = new String[var1.size()];

         for(int var8 = 0; var8 < var1.size(); ++var8) {
            var7[var8] = (String)var1.get(var8);
         }

         return var7;
      }
   }

   static ArrayList a(ArrayList var0, String var1, boolean var2, boolean var3, int[] var4) {
      var4[0] = 1;
      String[][] var5 = new String[var0.size()][];

      for(int var6 = 0; var6 < var0.size(); ++var6) {
         if (var0.get(var6) != null) {
            String var7 = com.aspose.cells.b.a.zr.a(var0.get(var6));
            var5[var6] = zbpt.a(var7, '\n');
            if (var5[var6] != null && var4[0] < var5[var6].length) {
               var4[0] = var5[var6].length;
            }
         }
      }

      ArrayList var13;
      if (var4[0] == 1) {
         var13 = new ArrayList();
         a(var0, var1, var13, true);
         return var13;
      } else {
         var13 = new ArrayList();

         int var14;
         for(var14 = 0; var14 < var4[0]; ++var14) {
            com.aspose.cells.b.a.a.ze.a(var13, (Object)(new ArrayList()));
         }

         for(var14 = 0; var14 < var5.length; ++var14) {
            int var8;
            if (var5[var14] == null) {
               for(var8 = 0; var8 < var4[0]; ++var8) {
                  zit var15 = new zit((Object)null, 0, (String)null);
                  com.aspose.cells.b.a.a.ze.a((ArrayList)var13.get(var8), (Object)var15);
               }
            } else {
               for(var8 = var4[0] - 1; var8 >= 0; --var8) {
                  int var9 = var4[0] - 1 - var8;
                  ArrayList var10 = (ArrayList)var13.get(var8);
                  if (var9 < var5[var14].length) {
                     String var11 = var5[var14][var9];
                     zit var12 = new zit(var11, 0, (String)null);
                     com.aspose.cells.b.a.a.ze.a((ArrayList)var13.get(var8), (Object)var12);
                     if (var11 != null) {
                        if (zsk.c(var11)) {
                           var12.g = 2;
                        } else {
                           var12.g = 5;
                        }
                     }
                  } else {
                     zit var16 = new zit((Object)null, 0, (String)null);
                     com.aspose.cells.b.a.a.ze.a((ArrayList)var13.get(var8), (Object)var16);
                  }
               }
            }
         }

         return var13;
      }
   }

   static ArrayList b(String var0) {
      ArrayList var1 = new ArrayList();
      boolean var2 = false;

      label66:
      for(int var3 = 0; var3 < var0.length(); ++var3) {
         String var4;
         int var5;
         if (var0.charAt(var3) == '"') {
            ++var3;

            for(var5 = var3; var3 < var0.length(); ++var3) {
               if (var0.charAt(var3) == '"') {
                  var4 = var0.substring(var5, var5 + (var3 - var5));
                  if ("".equals(var4)) {
                     com.aspose.cells.b.a.a.ze.a(var1, (Object)"0");
                  } else {
                     com.aspose.cells.b.a.a.ze.a(var1, (Object)var4.trim());
                  }

                  ++var3;

                  while(true) {
                     if (var3 >= var0.length() || var0.charAt(var3) == ',') {
                        continue label66;
                     }

                     ++var3;
                  }
               }
            }
         } else if (var0.charAt(var3) != ' ') {
            var5 = var3;
            if (var0.charAt(var3) == ',') {
               com.aspose.cells.b.a.a.ze.a(var1, (Object)"0");
            } else {
               ++var3;
               if (var3 == var0.length()) {
                  var4 = var0.substring(var5, var5 + (var3 - var5));
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var4.trim());
                  break;
               }

               for(; var3 < var0.length(); ++var3) {
                  if (var0.charAt(var3) == ',') {
                     var4 = var0.substring(var5, var5 + (var3 - var5));
                     com.aspose.cells.b.a.a.ze.a(var1, (Object)var4.trim());
                     break;
                  }

                  if (var3 == var0.length() - 1) {
                     var4 = var0.substring(var5, var5 + var3 - var5 + 1);
                     com.aspose.cells.b.a.a.ze.a(var1, (Object)var4.trim());
                  }
               }
            }
         }
      }

      return var1;
   }
}
